package com.example.demo.controller;

import com.example.demo.entity.Product.WorkArea;
import com.example.demo.service.WorkAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/workArea")
public class WorkAreaController {

    @Autowired
    WorkAreaService workAreaService;

    @PostMapping("/findByProperty")
    public List<WorkArea> findByProperty(@RequestBody Map<String, String> param) {
        String property = param.get("property");
        System.out.println(property);
        List<WorkArea> workAreas = workAreaService.findByProperty(property);
        for (WorkArea workArea : workAreas) {
            System.out.println(workArea);
        }
        return workAreas;
    }

}
